package com.qiang.util;

import java.util.concurrent.TimeUnit;

/**
 * @ClassName threadTest
 * @Author zhuhongqiang
 * @Date 2019/1/11 16:38
 */

public class threadTest implements Runnable {
    public static final int MAX = 50;
    public int index = 0;

    public void run() {
        while (index <= MAX){
            System.out.println(Thread.currentThread() + " 的号码是 : " + index++);
            try {
                TimeUnit.MILLISECONDS.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {

        final threadTest task = new threadTest();
        Thread t1 = new Thread(task,"一号窗口");
        Thread t2 = new Thread(task,"二号窗口");
        Thread t3 = new Thread(task,"三号窗口");
        t1.start();
        t2.start();
        t3.start();


    }
}
